# extensions.py
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()


def images_url_replace(img_url):
    img_url = img_url.strip()
    img_url = img_url.replace("_sum.jpg", "")
    img_url = img_url.replace("_.webp", "")
    return img_url


def image_path_format(path):
    path_str = str(path)
    path_str = path_str.replace("\\", "/")
    if path_str.startswith("static/"):
        path_str = path_str.replace("static/", "")
    return path_str
